﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
    Inherits="masterdata_Brand_Type_List" CodeFile="Brand_Type_List.aspx.cs" %>

<%@ Register Src="~/UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>包装列表 </title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        $(function () {
            var dlg = $('#dd').dialog({
                title: '品牌维护',
                closed: true,
                buttons: [{
                    text: '提交',
                    handler: function () {
                        $get('<%=btnSave.ClientID %>').click();
                    }
                }, {
                    text: '取消',
                    handler: function () {
                        $('#dd').dialog('close');
                    }
                }]
            });
            dlg.parent().appendTo(jQuery("form:first"));
        });

        function open1() {
            $('#dd').dialog('open');
        }
        function close1() {
            $('#dd').dialog('close');
        }
    </script>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div>
                <table id="wsd_inputtable">
                    <tr>
                        <td class="tabletitle" colspan="6">
                            查询条件
                        </td>
                    </tr>
                    <tr>
                        <td class="tablefield">
                            制造商:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlManu" runat="server" Width="130">
                            </asp:DropDownList>
                        </td>
                        <td class="tablefield">
                            品类:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlCategroy" runat="server" Width="130">
                            </asp:DropDownList>
                        </td>
                        <td class="tablefield">
                            有效:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlValid" runat="server" Width="130">
                                <asp:ListItem Value="-1" Text="--所有--"></asp:ListItem>
                                <asp:ListItem Value="1" Text="有效" Selected="True"></asp:ListItem>
                                <asp:ListItem Value="0" Text="无效"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="buttonarea" colspan="6">
                            <asp:Button ID="btnQuery" runat="server" CausesValidation="false" class="wsd_button2"
                                Text="查  询" OnClick="btnQuery_Click" />
                            &nbsp;&nbsp;
                            <input type="button" class="wsd_button2" size="47" value="重  置" name="reset" onclick="clearForm('form1')" />
                        </td>
                    </tr>
                </table><br />
                <table id="wsd_inputtable" width="100%">
                    <tr>
                        <td class="tabletitle">
                            品牌列表
                        </td>
                    </tr>
                </table>
                <table id="wsd_listtable" width="100%">
                    <tr>
                        <td style="width: 100%">
                            <asp:GridView QueryName="BrandTypeList" Width="100%" ID="GridView1" runat="server"
                                AutoGenerateColumns="False" BorderWidth="0" OnRowDataBound="Grid_RowDataBound"
                                EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                                EnableEmptyContentRender="true" DataKeyNames="ID" AllowPaging="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                                OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="10" EnableModelValidation="True">
                                <HeaderStyle CssClass="titlist" />
                                <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                                <Columns>
                                    <asp:TemplateField HeaderText="代码" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="Select"
                                                Text='<%# Eval("BrandCode") %>' OnClientClick="open1();"></asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="名称" ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="false" CommandName="Select"
                                                Text='<%# Eval("BrandName") %>' OnClientClick="open1();"></asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle Font-Underline="False" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="MANUFACTURER_NAME" HeaderText="制造商" />
                                    <asp:BoundField DataField="CATEGORY_NAME" HeaderText="品类" />
                                    <asp:TemplateField HeaderText="有效" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center">
                                        <ItemTemplate>
                                            <b>
                                                <%# (bool)Eval("ACTIVE") ? "<font size='3' color='green'>√</font>" : "<font size='3' color='red'>×</font>"%></b>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle CssClass="evenline" />
                                <AlternatingRowStyle CssClass="oddline" />
                                <PagerSettings Visible="false" FirstPageText="首页" LastPageText="尾页" Mode="NumericFirstLast"
                                    PageButtonCount="30" />
                            </asp:GridView>
                            <uc1:GridPager ID="GridPager1" runat="server" Visible="false" />
                        </td>
                    </tr>
                </table>
                <br />
                <table id="wsd_inputtable">
                    <tr>
                        <td width="100%" class="tabletitle">
                            操作选项
                        </td>
                    </tr>
                    <tr>
                        <td class="buttonarea">
                            <asp:Button ID="btnAdd" runat="server" class="wsd_button2" Text="新  增" OnClick="btnAdd_Click"
                                OnClientClick="open1();" CausesValidation="false" />
                        </td>
                    </tr>
                </table>
            </div>
            <div id="back" runat="server">
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnQuery" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <div id="dd" icon="icon-save" style="width: 400px; height: 260px;">
        <asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <table id="Table1" style="width: 100%">
                    <tr>
                        <td class="tabletitle">
                            <font color="red" size="2"><b>提示:*为必填项</b></font> &nbsp;
                        </td>
                        <td class="tabletitle">
                        </td>
                    </tr>
                </table>
                <table id="wsd_inputtable" style="width: 100%;border:0px;">
                    <tr>
                        <td>
                        <center>
                            <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="ObjectDataSource1"
                                DefaultMode="Insert" BorderStyle="None" GridLines="None" OnDataBound="DetailsView1_DataBound"
                                OnPageIndexChanging="DetailsView1_PageIndexChanging">
                                <PagerStyle HorizontalAlign="Right"></PagerStyle>
                                <Fields>
                                    <asp:TemplateField HeaderText="<font color=red>*</font>品牌代码:">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtCode" class="default" runat="server" MaxLength="20" Text='<%# Bind("BrandCode") %>'></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="品牌代码不能为空！"
                                                ControlToValidate="txtCode" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<font color=red>*</font>品牌名称:">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtName" class="default" runat="server" Text='<%# Bind("BrandName") %>'
                                                MaxLength="20"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="品牌名称不能为空！"
                                                ControlToValidate="txtName" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<font color=red>*</font>制造商名称:">
                                        <ItemTemplate>
                                            <asp:DropDownList ID="ddlManu" runat="server" Width="150">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="制造商名称不能为空！"
                                                ControlToValidate="ddlManu" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<font color=red>*</font>品类名称:">
                                        <ItemTemplate>
                                            <asp:DropDownList ID="ddlCategory" runat="server" Width="150">
                                            </asp:DropDownList>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="品类不能为空！"
                                                ControlToValidate="ddlCategory" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="有效 :">
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="chkValid" Checked='<%# Bind("ACTIVE") %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                                <RowStyle CssClass="tablefield" />
                            </asp:DetailsView>
                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Jumpton.SFA.Server.Entity.BRANDS"
                                InsertMethod="Save" SelectMethod="Load" TypeName="Jumpton.SFA.Server.BusinessRule.MasterData.BrandManager"
                                UpdateMethod="Save">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="GridView1" DefaultValue="" Name="ID" PropertyName="SelectedValue"
                                        Type="Int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource></center>
                        </td>
                    </tr>
                </table>
                <div style="display: none;">
                    <table id="Table3" style="width: 100%">
                        <tr>
                            <td height="10px" width="100%" class="tabletitle">
                                操作选项
                            </td>
                        </tr>
                        <tr>
                            <td class="buttonarea">
                                <asp:Button ID="btnSave" runat="server" class="wsd_button2" Text="保  存" OnClick="btnSave_Click" />&nbsp;&nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
